package com.cowin.sys.dao;

import com.cowin.base.Mapper;
import com.cowin.sys.model.TmSysResource;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface TmSysResourceMapper extends Mapper<TmSysResource> {
    /**
     * 功能描述: 根据用户ID获取Web 2级菜单<br>
     *
     * @param userId
     * @return:
     * @since: 1.0.0
     * @Author:yuchao
     * @Date: 2019/9/18 14:03
     */
    @Select("SELECT * FROM TM_SYS_RESOURCE where TM_SYS_RESOURCE_ID  in(SELECT DISTINCT(TM_SYS_RESOURCE_ID) FROM TR_SYS_ROLE_RESOURCE where TM_SYS_ROLE_ID in (SELECT TM_SYS_ROLE_ID FROM TR_SYS_USER_ROLE WHERE TM_SYS_USER_ID =#{userId})) and RESOURCE_TYPE='FUNC'")
    List<TmSysResource> getResourceByLoginUserId(Long userId);
}